import request from '@/config/axios'

// 评论 VO
export interface CommentVO {
  commentId: string // 评论ID
  relevanceId: string // 关系表ID
  content: string // 评论内容
  mkcontent: string // markdown原文
  projectId: number // 项目ID
  userId: number // 用户ID
  avatar: string // 用户头像
  parentId: string // 评论的父类ID
}

// 评论 API
export const CommentApi = {
  // 查询评论分页
  getCommentPage: async (params: any) => {
    return await request.get({ url: `/pypm/comment/page`, params })
  },

  // 查询评论详情
  getComment: async (id: number) => {
    return await request.get({ url: `/pypm/comment/get?id=` + id })
  },

  // 新增评论
  createComment: async (data: CommentVO) => {
    return await request.post({ url: `/pypm/comment/create`, data })
  },

  // 修改评论
  updateComment: async (data: CommentVO) => {
    return await request.put({ url: `/pypm/comment/update`, data })
  },

  // 删除评论
  deleteComment: async (id: number) => {
    return await request.delete({ url: `/pypm/comment/delete?id=` + id })
  },

  // 导出评论 Excel
  exportComment: async (params) => {
    return await request.download({ url: `/pypm/comment/export-excel`, params })
  }
}